﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Frontend.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Đăng ký thẻ giải trí
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table width="100%" border="1" cellspacing="0" cellpadding="0" class="tbl">
        <tr>
            <td align="center">
                <table width="100%" border="0" cellspacing="1" cellpadding="1">
                    <tr>
                        <td>
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="1%" class="br3">
                                        &nbsp;
                                    </td>
                                    <td width="33%" align="left" class="style2a">
                                        <strong>Đăng ký sở hữu thẻ</strong>
                                    </td>
                                    <td width="66%" class="br4" align="left">
                                        <div class="lprefix">
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="cmbox">
                                <div class="ccon">
                                    <%using (Html.BeginForm("Card", "Register", FormMethod.Post, new { id = "addForm", @class = "form" }))
                                      {%>
                                    <%=TempData["Message"]%>
                                    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="edit">
                                        <tr>
                                            <td class="label required">
                                                Họ và Tên <span>*</span>
                                            </td>
                                            <td class="input">
                                                <% 
                                                    Response.Write(Html.TextBox("FullName", "", new { @maxlength = "100", @style = "width:300px" }));
                                           
                                                %>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="label required">
                                                Giới Tính <span>*</span>
                                            </td>
                                            <td class="input">
                                                <% 
                                                    Response.Write(Html.RadioButton("Gender", "Nam", true, new { @id = "rbMale" }));
                                                    Response.Write("<label for=\"rbMale\">Nam</label>&nbsp;");
                                                    Response.Write(Html.RadioButton("Gender", "Nữ", false, new { @id = "rbFemale" }));
                                                    Response.Write("<label for=\"rbFemale\">Nữ</label>");
                                                %>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="label required">
                                                Địa Chỉ <span>*</span>
                                            </td>
                                            <td class="input">
                                                <% 
                                                    Response.Write(Html.TextArea("ContactAddress", "", new { @style = "width:300px", @maxlength = "200" }));               
                                                %>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="label">
                                                Nhận thẻ tại
                                            </td>
                                            <td class="input">
                                                <%
                                                    Response.Write(Html.CheckBox("chkReceive", true, new { @id = "chkReceive" }));
                                                    Response.Write("<label for=\"chkReceive\">&nbsp;Địa chỉ bên trên</label>");
                                                %>
                                            </td>
                                        </tr>
                                        <tr id="tr1" style="display: none">
                                            <td class="label required">
                                                Địa chỉ nhận thẻ <span>*</span>
                                            </td>
                                            <td class="input">
                                                <% 
                                                    Response.Write(Html.TextArea("ReceiveAdrress", "", new { @style = "width:300px", @maxlength = "200" }));               
                                                %>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="label required">
                                                Điện Thoại <span>*</span>
                                            </td>
                                            <td class="input">
                                                <% 
                                                    Response.Write(Html.TextBox("Phone", "", new { @style = "width:300px", @maxlength = "20" }));               
                                                %>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="label required">
                                                Email <span>*</span>
                                            </td>
                                            <td class="input">
                                                <% 
                                                    Response.Write(Html.TextBox("Email", "", new { @style = "width:300px", @maxlength = "200" }));               
                                                %>
                                            </td>
                                        </tr>
                                        <%--<tr>
                    <td class="label">
                        Trường học
                    </td>
                    <td class="input">
                        <% 
                            Response.Write(Html.TextBox("School","", new { @style = "width:300px", @maxlength = "200" }));               
                        %>
                    </td>
                </tr>
               <tr>
                    <td class="label required">
                        Niên khóa <span>*</span>
                    </td>
                    <td class="input">
                        <% 
                            Response.Write(Html.TextBox("SchoolYear","", new { @style = "width:300px", @maxlength = "200" }));               
                        %>
                    </td>
                </tr>--%>
                                        <tr>
                                            <td class="label">
                                            </td>
                                            <td class="input">
                                                <%
                                                    Response.Write(Html.CheckBox("chkAgreeName", false, new { @id = "chkAgree" }));
                                                    Response.Write("<label for=\"chkAgree\">&nbsp;Tôi đồng ý đóng phí phát hành thẻ 20.000đ</label>");
                                                %>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="label">
                                                Mã bảo vệ
                                            </td>
                                            <td class="input">
                                                <img src="/Mabaove" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="label required">
                                                Nhập mã bảo vệ <span>*</span>
                                            </td>
                                            <td class="input">
                                                <input type="text" id="Text1" name="txtCapcha" maxlength="10" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                            </td>
                                            <td>
                                                <input type="submit" value="Đăng ký" class="button" id="Submit1" />
                                                <input type="reset" value="Làm lại" class="button" id="Reset1" />
                                            </td>
                                        </tr>
                                    </table>
                                    <% } %>
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        var formIndex = 0;
        $(document).ready(function () {

            //add method valid fone
            jQuery.validator.addMethod(
            "validatePhone", function (value) {
                return JS_LIB.isPhone(value);
            }, 'Chỉ được nhập các ký tự : 0123456789.,()-+ ');
            $("#chkReceive").click(function () {
                isChecked = $('input[name=chkReceive]').is(':checked');

                if (isChecked) {
                    $("#trReceiveAddress").css("display", "none");
                    $("#ReceiveAdrress").rules("remove");
                    $("#ReceiveAdrress").val('');
                } else {
                    $("#trReceiveAddress").css("display", "");
                    $("#ReceiveAdrress").rules("add", {
                        required: true,
                        maxlength: 200

                    });

                }
            });
            $("#btnCancel").click(function () {
                window.location = "dang-ky-lam-thanh-vien-the-sinh-vien.html";
            });
            $("#save").click(function () {
                isChecked = $('input[name=chkAgreeName]').is(':checked');
                if (!isChecked) {
                    JS_LIB.msgBox("Vui lòng nhấn \"Tôi đồng ý đóng phí phát hành thẻ 20.000đ\"", 300);
                    return false;
                }
                return true;
            });
            $("#addForm").validate({
                debug: false,
                errorElement: "span",
                errorPlacement: function (error, element) {
                    error.tooltip({
                        bodyHandler: function () {
                            return error.html();
                        }
                    });
                    error.insertAfter(element);
                },
                rules: {
                    FullName: {
                        required: true
                    },
                    Address: {
                        required: true,
                        maxlength: 255
                    },
                    Phone: {
                        required: true,
                        validatePhone: true
                    },
                    Email: {
                        required: true,
                        email: true
                    },
                    SchoolYear: {
                        required: true

                    },
                    txtCapcha: {
                        required: true

                    }
                },
                submitHandler: function (form) {
                    if (formIndex == 0) {
                        form.submit();
                        formIndex++;
                    }
                }
            });
        });

    </script>
</asp:Content>
